<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:f="http://java.sun.com/jsf/core"
      xmlns:p="http://primefaces.org/ui">

    <h:head>
        <title>TAG - Login</title>
        <link rel="Stylesheet" type="text/css" href="../resources/css/login.css"></link>
    </h:head>
    
    <h:body>
        <span class="loginIPTI"></span>
        <div id="telaLogin">
            <span class="logoWelcome"></span>
            <h:form id="loginForm">
                <h:panelGroup id="loginGroup" rendered="#{empty loginBean.actorList}">
                    <p:focus context="loginGroup"/>
                    <h:message errorStyle="color: red" infoStyle="color: gray" for="loginGrid"/>
                    <span class="spanText">Por favor, forneça os dados abaixo para entrar no sistema:</span>
                    <span class="space"/>

                    <h:panelGrid id="loginGrid" styleClass="loginGrid" columns="2">
                        <h:outputLabel for="login" value="Login:"/>
                        <p:inputText id="login" styleClass="logins" value="#{loginBean.login.userName}"/>               
                        <h:outputLabel for="password" value="Senha:"/>
                        <p:password id="password" styleClass="pass" value="#{loginBean.login.password}" feedback="false"/>
                        <p:commandButton value="Login" styleClass="loginButton" action="#{loginBean.preLogin()}" update="@form"/>
                    </h:panelGrid>
                </h:panelGroup>

                <h:panelGroup id="actorList" rendered="#{loginBean.actorList.size() > 1}">
                    <span class="confirmationText">Pronto! Você já entrou no sistema. Agora, forneça o nível de autorização que deseja acessar:</span>
                    <br/>
                    <h:selectOneMenu id="actorID" styleClass="actorID" value="#{loginBean.actorID}">
                        <f:selectItems value="#{loginBean.actorList}"/>
                    </h:selectOneMenu>
                    <span class="space"/>
                    <p:commandButton value="OK" ajax="true" process="@form" action="#{loginBean.loginFinal()}"/>
                </h:panelGroup>
            </h:form>
        </div>
        <p:ajaxStatus onstart="statusDialog.show()" onsuccess="statusDialog.hide()"/>
        <p:dialog modal="true" widgetVar="statusDialog" 
                draggable="false" closable="false" resizable="false">
            CARREGANDO<br/>
            <p:graphicImage value="../resources/images/ajax/ajaxloader.gif"/>
        </p:dialog>
        <span class="loginBG"></span>
    </h:body>
</html>
